/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.pbs.facades;

import br.com.pbs.exeptions.BancoExeption;
import br.com.pbs.factory.Factory;
import br.com.pbs.interfaces.IFacadePessoa;
import br.com.pbs.interfaces.IFactoryPessoa;
import br.com.pbs.interfaces.IPessoaDao;
import br.com.pbs.pojos.Professor;
import java.util.List;

/**
 *
 * @author Luiz Segundo
 */
public class FacadeProfessor implements IFacadePessoa<Professor>{

        IFactoryPessoa factory = new Factory();
        IPessoaDao professorDao = factory.getProfessorDao();

        public boolean cadatraPessoa(Professor p) throws BancoExeption {
                return professorDao.save(p);
        }

        public boolean deletaPessoa(Professor p) throws BancoExeption {
                return professorDao.delete(p);
        }

        public Professor buscaPorNome(String nome) throws BancoExeption {
                return (Professor) professorDao.buscaObjetoPorNome(nome, new Professor());
        }

        public boolean atualizaPessoa(Professor p) throws BancoExeption {
                return professorDao.update(p);
        }

        public List<Professor> listaDeNomes(String nome) throws BancoExeption {
                return (List) professorDao.listaTodos(new Professor());
        }

}
